package com.nulldev.util.net.sdtp;

import com.nulldev.util.net.packets.NetInfoAdapter;
import com.nulldev.util.net.packets.NetPacket;
import com.nulldev.util.net.packets.PacketManager;
import com.nulldev.util.net.tcp.client.TCPClient;

@Deprecated
public class SDTPClient extends TCPClient{

	public SDTPClient() {
		super("sdtpClient", "openSDTP Client", "", 0);
	}
	
	@Override
	public void receive (String event, String payload, byte[] bytes, long count, final long readTime) {
		final NetPacket packet = PacketManager.parsePacket(this, null, event);
		if (!packet.getID().equals("fs.data") && !packet.getID().equals("html.proxy.data")) {
			//System.out.println(packet);
		}else {
		}
		if (!packet.isGeneric()) {
			packet.client(packet.getData(), event, NetInfoAdapter.create(this.getConnection()));
		}
	}

	public void disconnect() {
		super.requestDisconnect();
	}

	public void genericInit() {
		super.sendBlocking(PacketManager.byID("gen.ping"));
		super.sendBlocking(PacketManager.byID("p2pc.defip"));
		super.sendBlocking(PacketManager.byID("p2pc.key"));
		super.sendBlocking(PacketManager.byID("sdtp.supported"));
	}

}
